namespace CIS.Customer
{
    using CISLib;
    using CISLib.EncryptClasses;
    using System;
    using System.Configuration;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class OtherCustomerVisitingAbroadPage : Page
    {
        protected TextBox ABVenueTxb;
        protected Button Add;
        protected TextBox ASBAccompanyTxb;
        protected DropDownList DayDdl;
        protected DropDownList DayToDdl;
        protected CheckBox EditChk;
        protected Image iBtnCustomer;
        protected ImageButton iBtnGray8;
        protected ImageButton iBtnOrange0;
        protected ImageButton iBtnOrange1;
        protected ImageButton iBtnOrange2;
        protected ImageButton iBtnOrange3;
        protected ImageButton iBtnOrange4;
        protected ImageButton iBtnOrange5;
        protected ImageButton iBtnOrange6;
        protected ImageButton iBtnOrange7;
        protected Label lbABVenue;
        protected Label lbASBAccompany;
        protected Label lbDate;
        protected Label lbEdit;
        protected Label lbFrom;
        protected Label lbMainActivity;
        protected Label lbMonth;
        protected Label lbSaveMsg;
        protected Label lbTo;
        protected Label lbToDate;
        protected Label lbToMonth;
        protected Label lbToYear;
        protected Label lbVisitAvroad;
        protected Label lbYear;
        protected LinkButton lkbClear;
        protected TextBox MainActivityTxb;
        protected DropDownList MonthDdl;
        protected DropDownList MonthToDdl;
        protected UserPrincipal Principal = null;
        protected ImageButton returnImgBtn;
        protected Repeater rptVisitingAbroad;
        protected Button SaveBtn;
        protected DropDownList VenueDdl;
        protected DropDownList YearDdl;
        protected DropDownList YearToDdl;

        private void Add_Click(object sender, EventArgs e)
        {
            switch (this.Session["language"].ToString())
            {
                case "cn":
                {
                    string strTmp = this.VenueDdl.SelectedItem.Text;
                    this.ABVenueTxb.Text = this.ABVenueTxb.Text + strTmp + ",";
                    break;
                }
                case "en":
                {
                    string strTmp = this.VenueDdl.SelectedItem.Value;
                    this.ABVenueTxb.Text = this.ABVenueTxb.Text + strTmp + ",";
                    break;
                }
            }
        }

        protected string AddStrPrefix(object obj, string strPre)
        {
            if ((obj.ToString() == string.Empty) || (obj.ToString() == "\0\0\0\0"))
            {
                return "";
            }
            string language = this.Session["language"].ToString();
            string path = base.Server.MapPath("~/LanguageConfig.xml");
            return (ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", strPre, language, path) + obj.ToString());
        }

        protected string DecryptString(object obj)
        {
            DESEncrypt mydes = new DESEncrypt();
            return mydes.DecryptString(obj.ToString());
        }

        private void FillPage()
        {
            Guid customerId = new Guid(base.Request.QueryString["CustomerId"]);
            if ((this.Principal.SysUser.IsAdmin <= 0) && !ManageSystemConfig.IsThisCustomerMaster(this.Principal.SysUser.UserId, customerId))
            {
                this.ABVenueTxb.ReadOnly = true;
                this.MainActivityTxb.ReadOnly = true;
                this.ASBAccompanyTxb.ReadOnly = true;
                this.lbEdit.Visible = false;
                this.EditChk.Visible = false;
                this.SaveBtn.Visible = false;
            }
            this.RptDataBind();
        }

        private void iBtnOrange0_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerBasicInfoPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange1_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoPersonalPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange2_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoPreferencePage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange3_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoHealthCostumePage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange4_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoTravelPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange5_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoStudyPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange6_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoWorkPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void iBtnOrange7_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string customerId = base.Request.QueryString["CustomerId"].ToString();
                base.Response.Redirect("~/Customer/CustomerInfoFamilyPage.aspx?IsModify=True&CustomerId=" + customerId.ToString(), true);
            }
            catch (Exception)
            {
            }
        }

        private void InitializeComponent()
        {
            this.iBtnOrange0.Click += new ImageClickEventHandler(this.iBtnOrange0_Click);
            this.iBtnOrange1.Click += new ImageClickEventHandler(this.iBtnOrange1_Click);
            this.iBtnOrange2.Click += new ImageClickEventHandler(this.iBtnOrange2_Click);
            this.iBtnOrange3.Click += new ImageClickEventHandler(this.iBtnOrange3_Click);
            this.iBtnOrange4.Click += new ImageClickEventHandler(this.iBtnOrange4_Click);
            this.iBtnOrange5.Click += new ImageClickEventHandler(this.iBtnOrange5_Click);
            this.iBtnOrange6.Click += new ImageClickEventHandler(this.iBtnOrange6_Click);
            this.iBtnOrange7.Click += new ImageClickEventHandler(this.iBtnOrange7_Click);
            this.rptVisitingAbroad.ItemCommand += new RepeaterCommandEventHandler(this.rptVisitingAbroad_ItemCommand);
            this.Add.Click += new EventHandler(this.Add_Click);
            this.lkbClear.Click += new EventHandler(this.lkbClear_Click);
            this.SaveBtn.Click += new EventHandler(this.SaveBtn_Click);
            this.returnImgBtn.Click += new ImageClickEventHandler(this.returnImgBtn_Click);
            base.Load += new EventHandler(this.Page_Load);
        }

        private void InitPage()
        {
            this.SetFromImage();
            this.SetFrom();
            this.InitVenueDdl();
            this.lbSaveMsg.Text = string.Empty;
            this.YearDdl.Items.Clear();
            this.MonthDdl.Items.Clear();
            this.DayDdl.Items.Clear();
            ListItem tmpItem = new ListItem();
            tmpItem.Text = "----";
            this.YearDdl.Items.Add(tmpItem);
            ListItem tmpItem1 = new ListItem();
            tmpItem1.Text = "--";
            this.MonthDdl.Items.Add(tmpItem1);
            this.DayDdl.Items.Add(tmpItem1);
            for (int i = DateTime.Now.Year; i >= 0x78a; i--)
            {
                ListItem YearItem = new ListItem();
                YearItem.Text = i.ToString();
                this.YearDdl.Items.Add(YearItem);
            }
            for (int i = 1; i <= 12; i++)
            {
                ListItem MonthItem = new ListItem();
                MonthItem.Text = i.ToString();
                this.MonthDdl.Items.Add(MonthItem);
            }
            for (int i = 1; i <= 0x1f; i++)
            {
                ListItem DateItem = new ListItem();
                DateItem.Text = i.ToString();
                this.DayDdl.Items.Add(DateItem);
            }
            this.YearToDdl.Items.Clear();
            this.MonthToDdl.Items.Clear();
            this.DayToDdl.Items.Clear();
            ListItem tmpToItem = new ListItem();
            tmpToItem.Text = "----";
            this.YearToDdl.Items.Add(tmpToItem);
            ListItem tmpToItem1 = new ListItem();
            tmpToItem1.Text = "--";
            this.MonthToDdl.Items.Add(tmpToItem1);
            this.DayToDdl.Items.Add(tmpToItem1);
            for (int i = DateTime.Now.Year; i >= 0x78a; i--)
            {
                ListItem YearItem = new ListItem();
                YearItem.Text = i.ToString();
                this.YearToDdl.Items.Add(YearItem);
            }
            for (int i = 1; i <= 12; i++)
            {
                ListItem MonthItem = new ListItem();
                MonthItem.Text = i.ToString();
                this.MonthToDdl.Items.Add(MonthItem);
            }
            for (int i = 1; i <= 0x1f; i++)
            {
                ListItem DateItem = new ListItem();
                DateItem.Text = i.ToString();
                this.DayToDdl.Items.Add(DateItem);
            }
        }

        private void InitVenueDdl()
        {
            string language = this.Session["language"].ToString();
            string cnName = ConfigurationSettings.AppSettings["CountryCh"];
            string enName = ConfigurationSettings.AppSettings["CountryEn"];
            string[] cnAry = cnName.Split(new char[] { ',' });
            string[] enAry = enName.Split(new char[] { ',' });
            this.VenueDdl.Items.Clear();
            for (int i = 0; i < cnAry.Length; i++)
            {
                ListItem tmpItem = new ListItem();
                switch (language)
                {
                    case "cn":
                        tmpItem.Text = cnAry[i];
                        break;

                    case "en":
                        tmpItem.Text = enAry[i];
                        break;
                }
                tmpItem.Value = enAry[i];
                this.VenueDdl.Items.Add(tmpItem);
            }
        }

        private void lkbClear_Click(object sender, EventArgs e)
        {
            this.ABVenueTxb.Text = string.Empty;
        }

        protected override void OnInit(EventArgs e)
        {
            this.InitializeComponent();
            base.OnInit(e);
            this.Principal = this.Context.User as UserPrincipal;
        }

        private void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                this.SelectAuth();
            }
        }

        private void returnImgBtn_Click(object sender, ImageClickEventArgs e)
        {
            base.Response.Redirect("~/Customer/CustomerInfoOtherPage.aspx?IsModify=True&CustomerId=" + base.Request.QueryString["CustomerId"].ToString(), true);
        }

        private void RptDataBind()
        {
            this.rptVisitingAbroad.DataSource = ManageCustomer.GetCustomerVisitingAbroadInfo(new Guid(base.Request.QueryString["CustomerId"]));
            this.rptVisitingAbroad.DataBind();
        }

        private void rptVisitingAbroad_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (this.Principal.OwnRole.TypeB == 0)
            {
                base.Response.Write("<script> alert('没有权限操作！') </script>");
            }
            else
            {
                Guid customerId = new Guid(base.Request.QueryString["CustomerId"]);
                if ((this.Principal.SysUser.IsAdmin <= 0) && !ManageSystemConfig.IsThisCustomerMaster(this.Principal.SysUser.UserId, customerId))
                {
                    base.Response.Write("<script> alert('没有权限操作！') </script>");
                }
                else
                {
                    string cmd = e.CommandName;
                    string strTmp = (string) e.CommandArgument;
                    Guid customerVisitingAbroadId = new Guid(strTmp);
                    switch (cmd)
                    {
                        case "delete":
                            ManageCustomer.RemoveCustomerVisitingAbroadInfoViaId(customerVisitingAbroadId);
                            this.InitPage();
                            this.FillPage();
                            break;

                        case "modify":
                        {
                            CustomerVisitingAbroad customerVisitingAbroad = ManageCustomer.GetCustomerVisitingAbroadInfoViaId(customerVisitingAbroadId);
                            if (customerVisitingAbroad != null)
                            {
                                try
                                {
                                    this.ABVenueTxb.Text = customerVisitingAbroad.ABVenue;
                                    this.MainActivityTxb.Text = customerVisitingAbroad.MainActivity;
                                    this.ASBAccompanyTxb.Text = customerVisitingAbroad.ASBAccompany;
                                    if (customerVisitingAbroad.ABVenue != "")
                                    {
                                        string language = this.Session["language"].ToString();
                                        string strABVenue = customerVisitingAbroad.ABVenue;
                                        strABVenue = strABVenue.Substring(0, strABVenue.IndexOf("\0"));
                                        string[] strABVenueAry = strABVenue.Split(new char[] { ',' });
                                        string cnName = ConfigurationSettings.AppSettings["CountryCh"];
                                        string enName = ConfigurationSettings.AppSettings["CountryEn"];
                                        string[] cnAry = cnName.Split(new char[] { ',' });
                                        string[] enAry = enName.Split(new char[] { ',' });
                                        string strResultTmp = "";
                                        switch (language)
                                        {
                                            case "cn":
                                                for (int i = 0; i < strABVenueAry.Length; i++)
                                                {
                                                    for (int j = 0; j < enAry.Length; j++)
                                                    {
                                                        if (strABVenueAry[i] == enAry[j])
                                                        {
                                                            strResultTmp = strResultTmp + cnAry[j] + ",";
                                                        }
                                                    }
                                                }
                                                if (strResultTmp != "")
                                                {
                                                    strResultTmp = strResultTmp.Substring(0, strResultTmp.Length - 1);
                                                }
                                                break;

                                            case "en":
                                                strResultTmp = strABVenue;
                                                break;
                                        }
                                        this.ABVenueTxb.Text = strResultTmp + ",";
                                    }
                                    else
                                    {
                                        this.ABVenueTxb.Text = "";
                                    }
                                    if (((customerVisitingAbroad.ABTime.Year == 0x708) && (customerVisitingAbroad.ABTime.Month == 1)) && (customerVisitingAbroad.ABTime.Day == 1))
                                    {
                                        this.YearDdl.SelectedIndex = 0;
                                        this.MonthDdl.SelectedIndex = 0;
                                        this.DayDdl.SelectedIndex = 0;
                                    }
                                    else
                                    {
                                        for (int i = 0; i < this.YearDdl.Items.Count; i++)
                                        {
                                            if (this.YearDdl.Items[i].Text == customerVisitingAbroad.ABTime.Year.ToString())
                                            {
                                                this.YearDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                        for (int i = 0; i < this.MonthDdl.Items.Count; i++)
                                        {
                                            if (this.MonthDdl.Items[i].Text == customerVisitingAbroad.ABTime.Month.ToString())
                                            {
                                                this.MonthDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                        for (int i = 0; i < this.DayDdl.Items.Count; i++)
                                        {
                                            if (this.DayDdl.Items[i].Text == customerVisitingAbroad.ABTime.Day.ToString())
                                            {
                                                this.DayDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                    }
                                    if (((customerVisitingAbroad.ABToTime.Year == 0x708) && (customerVisitingAbroad.ABToTime.Month == 1)) && (customerVisitingAbroad.ABToTime.Day == 1))
                                    {
                                        this.YearToDdl.SelectedIndex = 0;
                                        this.MonthToDdl.SelectedIndex = 0;
                                        this.DayToDdl.SelectedIndex = 0;
                                    }
                                    else
                                    {
                                        for (int i = 0; i < this.YearToDdl.Items.Count; i++)
                                        {
                                            if (this.YearToDdl.Items[i].Text == customerVisitingAbroad.ABToTime.Year.ToString())
                                            {
                                                this.YearToDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                        for (int i = 0; i < this.MonthToDdl.Items.Count; i++)
                                        {
                                            if (this.MonthToDdl.Items[i].Text == customerVisitingAbroad.ABToTime.Month.ToString())
                                            {
                                                this.MonthToDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                        for (int i = 0; i < this.DayToDdl.Items.Count; i++)
                                        {
                                            if (this.DayToDdl.Items[i].Text == customerVisitingAbroad.ABToTime.Day.ToString())
                                            {
                                                this.DayToDdl.SelectedIndex = i;
                                                break;
                                            }
                                        }
                                    }
                                    this.EditChk.Checked = true;
                                    this.Page.Session.Add("CustomerVisitingAbroadId", customerVisitingAbroad.CustomerVisitingAbroadId.ToString());
                                }
                                catch (Exception)
                                {
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }

        private void SaveBtn_Click(object sender, EventArgs e)
        {
            string strMainActivity = this.MainActivityTxb.Text.Trim();
            string strASBAccompany = this.ASBAccompanyTxb.Text.Trim();
            string strABVenue = this.ABVenueTxb.Text.Trim();
            if (!(strABVenue != ""))
            {
                strABVenue = "";
            }
            else
            {
                strABVenue = strABVenue.Substring(0, strABVenue.Length - 1);
                string[] strABVenueAry = strABVenue.Split(new char[] { ',' });
                string cnName = ConfigurationSettings.AppSettings["CountryCh"];
                string enName = ConfigurationSettings.AppSettings["CountryEn"];
                string[] cnAry = cnName.Split(new char[] { ',' });
                string[] enAry = enName.Split(new char[] { ',' });
                string language = this.Session["language"].ToString();
                string strTmp = "";
                switch (language)
                {
                    case "cn":
                        for (int i = 0; i < strABVenueAry.Length; i++)
                        {
                            for (int j = 0; j < cnAry.Length; j++)
                            {
                                if (strABVenueAry[i] == cnAry[j])
                                {
                                    strTmp = strTmp + enAry[j] + ",";
                                }
                            }
                        }
                        strTmp = strTmp.Substring(0, strTmp.Length - 1);
                        break;

                    case "en":
                        strTmp = strABVenue;
                        break;
                }
                strABVenue = strTmp;
            }
            try
            {
                DateTime VisitingAbroadDate = new DateTime(0x708, 1, 1);
                DateTime VisitingAbroadToDate = new DateTime(0x708, 1, 1);
                if (((this.YearDdl.SelectedItem.Text != "----") || (this.MonthDdl.SelectedItem.Text != "--")) || (this.DayDdl.SelectedItem.Text != "--"))
                {
                    VisitingAbroadDate = new DateTime(Convert.ToInt32(this.YearDdl.SelectedItem.Text), Convert.ToInt32(this.MonthDdl.SelectedItem.Text), Convert.ToInt32(this.DayDdl.SelectedItem.Text));
                }
                if (((this.YearToDdl.SelectedItem.Text != "----") || (this.MonthToDdl.SelectedItem.Text != "--")) || (this.DayToDdl.SelectedItem.Text != "--"))
                {
                    VisitingAbroadToDate = new DateTime(Convert.ToInt32(this.YearToDdl.SelectedItem.Text), Convert.ToInt32(this.MonthToDdl.SelectedItem.Text), Convert.ToInt32(this.DayToDdl.SelectedItem.Text));
                }
                if (this.EditChk.Checked)
                {
                    ManageCustomer.UpdateCustomerVisitingAbroadInfo(new Guid(this.Page.Session["CustomerVisitingAbroadId"].ToString()), VisitingAbroadDate, strABVenue, strMainActivity, strASBAccompany, VisitingAbroadToDate);
                    ManageLog.InsertLog(this.Principal.SysUser.UserId, this.Principal.SysUser.LoginName, DateTime.Now, "UpdateVisAbroad", "IP:" + base.Request.UserHostAddress + " DNS:" + base.Request.UserHostName, ManageCustomer.GetCustomerBasicInfoViaId(new Guid(base.Request.QueryString["CustomerId"])).Name, new Guid(base.Request.QueryString["CustomerId"]));
                }
                else
                {
                    ManageCustomer.InsertNewCustomerVisitingAbroadInfo(new Guid(base.Request.QueryString["CustomerId"]), VisitingAbroadDate, strABVenue, strMainActivity, strASBAccompany, VisitingAbroadToDate);
                    ManageLog.InsertLog(this.Principal.SysUser.UserId, this.Principal.SysUser.LoginName, DateTime.Now, "InsertVisAbroad", "IP:" + base.Request.UserHostAddress + " DNS:" + base.Request.UserHostName, ManageCustomer.GetCustomerBasicInfoViaId(new Guid(base.Request.QueryString["CustomerId"])).Name);
                }
                this.EditChk.Checked = false;
                this.InitPage();
                this.ABVenueTxb.Text = string.Empty;
                this.MainActivityTxb.Text = string.Empty;
                this.ASBAccompanyTxb.Text = string.Empty;
            }
            catch (ArgumentOutOfRangeException exOutOfRange)
            {
                this.lbSaveMsg.Text = exOutOfRange.Message;
                return;
            }
            catch (Exception ex)
            {
                this.lbSaveMsg.Text = ex.Message;
                return;
            }
            this.RptDataBind();
            this.lbSaveMsg.Text = "Save successfully!";
        }

        private void SelectAuth()
        {
            if (this.Principal.OwnRole.TypeB == 0)
            {
                this.InitPage();
                this.FillPage();
                this.ABVenueTxb.ReadOnly = true;
                this.MainActivityTxb.ReadOnly = true;
                this.ASBAccompanyTxb.ReadOnly = true;
                this.lbEdit.Visible = false;
                this.EditChk.Visible = false;
                this.SaveBtn.Visible = false;
            }
            else if (this.Principal.OwnRole.TypeB == 1)
            {
                this.InitPage();
                this.FillPage();
            }
        }

        private void SetFrom()
        {
            string language = this.Session["language"].ToString();
            string path = base.Server.MapPath("~/LanguageConfig.xml");
            this.lbVisitAvroad.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbVisitAvroad", language, path);
            this.lbYear.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbYear", language, path);
            this.lbMonth.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbMonth", language, path);
            this.lbDate.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbDate", language, path);
            this.lbABVenue.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbABVenue", language, path);
            this.lbMainActivity.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbMainActivity", language, path);
            this.lbASBAccompany.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbASBAccompany", language, path);
            this.lbEdit.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbEdit", language, path);
            this.SaveBtn.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "SaveBtn", language, path);
            this.lbToYear.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbToYear", language, path);
            this.lbToMonth.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbToMonth", language, path);
            this.lbToDate.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbToDate", language, path);
            this.lbTo.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbTo", language, path);
            this.lbFrom.Text = ManageSystemConfig.GetSystemSetLanguage("OtherCustomerVisitingAbroadPage", "lbFrom", language, path);
        }

        private void SetFromImage()
        {
            switch (this.Session["language"].ToString())
            {
                case "cn":
                    this.iBtnCustomer.ImageUrl = "../images/title_customerinfo.jpg";
                    this.iBtnOrange0.ImageUrl = "../images/title_CustomerInfo_lable_1_orange.jpg";
                    this.iBtnOrange1.ImageUrl = "../images/title_CustomerInfo_lable_2_orange.jpg";
                    this.iBtnOrange2.ImageUrl = "../images/title_CustomerInfo_lable_3_orange.jpg";
                    this.iBtnOrange3.ImageUrl = "../images/title_CustomerInfo_lable_4_orange.jpg";
                    this.iBtnOrange4.ImageUrl = "../images/title_CustomerInfo_lable_5_orange.jpg";
                    this.iBtnOrange5.ImageUrl = "../images/title_CustomerInfo_lable_6_orange.jpg";
                    this.iBtnOrange6.ImageUrl = "../images/title_CustomerInfo_lable_7_orange.jpg";
                    this.iBtnOrange7.ImageUrl = "../images/title_CustomerInfo_lable_8_orange.jpg";
                    this.iBtnGray8.ImageUrl = "../images/title_CustomerInfo_lable_9_Gray.jpg";
                    break;

                case "en":
                    this.iBtnCustomer.ImageUrl = "../images/title_customerinfoEn.jpg";
                    this.iBtnOrange0.ImageUrl = "../images/title_CustomerInfoEn_lable_1_orange.jpg";
                    this.iBtnOrange1.ImageUrl = "../images/title_CustomerInfoEn_lable_2_orange.jpg";
                    this.iBtnOrange2.ImageUrl = "../images/title_CustomerInfoEn_lable_3_orange.jpg";
                    this.iBtnOrange3.ImageUrl = "../images/title_CustomerInfoEn_lable_4_orange.jpg";
                    this.iBtnOrange4.ImageUrl = "../images/title_CustomerInfoEn_lable_5_orange.jpg";
                    this.iBtnOrange5.ImageUrl = "../images/title_CustomerInfoEn_lable_6_orange.jpg";
                    this.iBtnOrange6.ImageUrl = "../images/title_CustomerInfoEn_lable_7_orange.jpg";
                    this.iBtnOrange7.ImageUrl = "../images/title_CustomerInfoEn_lable_8_orange.jpg";
                    this.iBtnGray8.ImageUrl = "../images/title_CustomerInfoEn_lable_9_Gray.jpg";
                    break;
            }
        }

        protected string SetVenueLanguage(object obj)
        {
            string language = this.Session["language"].ToString();
            string strABVenue = obj.ToString();
            strABVenue = strABVenue.Substring(0, strABVenue.IndexOf("\0"));
            string[] strABVenueAry = strABVenue.Split(new char[] { ',' });
            string cnName = ConfigurationSettings.AppSettings["CountryCh"];
            string enName = ConfigurationSettings.AppSettings["CountryEn"];
            string[] cnAry = cnName.Split(new char[] { ',' });
            string[] enAry = enName.Split(new char[] { ',' });
            string strTmp = "";
            switch (language)
            {
                case "cn":
                    for (int i = 0; i < strABVenueAry.Length; i++)
                    {
                        for (int j = 0; j < enAry.Length; j++)
                        {
                            if (strABVenueAry[i] == enAry[j])
                            {
                                strTmp = strTmp + cnAry[j] + ",";
                            }
                        }
                    }
                    if (strTmp == "")
                    {
                        return strTmp;
                    }
                    return strTmp.Substring(0, strTmp.Length - 1);

                case "en":
                    return strABVenue;
            }
            return strTmp;
        }

        protected string ValidateDateTime(object tmpObj)
        {
            string strTmp = tmpObj.ToString();
            if (strTmp.Substring(0, 4) == "1800")
            {
                return "---- -- --";
            }
            return strTmp;
        }
    }
}

